@namespace Microsoft.FluentUI.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Rendering
@inherits FluentComponentBase

<CascadingValue Value="this" IsFixed="true">
    <fluent-dialog @ref="Element"
                   id="@Id"
                   class="@ClassValue"
                   style="@StyleValue"
                   modal="@((Modal ?? _parameters.Modal).ToString()?.ToLower())"
                   hidden="@Hidden"
                   trap-focus="@((TrapFocus ?? _parameters.TrapFocus).ToString()?.ToLower())"
                   aria-describedby=@(_parameters.AriaDescribedby ?? AriaDescribedby)
                   aria-labelledby=@(_parameters.AriaLabelledby ?? AriaLabelledby)
                   aria-label=@(_parameters.AriaLabel ?? AriaLabel)
                   @attributes=@AdditionalAttributes>

        @* Default Header *@
        @if (HasDefaultDialogHeader)
        {
            <FluentDialogHeader Data="@FluentDialogHeader.DefaultDialogHeaderIdentifier" />
        }

        @* Content *@
        @if (Instance is null)
        {
            @ChildContent
        }
        else
        {
            <DynamicComponent Type="@Instance.ContentType" Parameters="Instance.GetParameterDictionary()" />
        }

        @* Default Footer *@
        @if (HasDefaultDialogFooter)
        {
            <FluentDialogFooter Data="@FluentDialogFooter.DefaultDialogFooterIdentifier" />
        }

    </fluent-dialog>
</CascadingValue>